private ["_unit","_gear","_backpack","_backpack2","_backpack_items","_backpack_weap","_backpack_mags"];

_unit = _this;

//修改为单位一次性使用，而非全自动
/*
while {true} do
{
	
	waitUntil {
		Sleep 0.5;
		((position _unit select 2 > 50)
		&& {alive _unit}
		&& {_unit getVariable ['FAR_isUnconscious',0] == 0}
		&& {vehicle _unit == _unit})};
*/	
		
		
	
    waitUntil {(position _unit select 2) <= 1000}; 
           
	//记录背包
	_gear = [];
	_backpack = backpack _unit;
	_backpack2 = unitbackpack _unit;
	_backpack_items = getItemCargo (unitBackpack _unit);
	_backpack_weap = getWeaponCargo (unitBackpack _unit);
	_backpack_mags = getMagazineCargo (unitBackpack _unit);
	_gear =  [_backpack_items, _backpack_weap, _backpack_mags];
	

	removeBackpack _unit;
	
	//等待移除
	waitUntil{(backpack _unit) == ""};
	_unit addBackpack "B_Parachute";
	waitUntil{(backpack _unit) != ""};
	//跳
	_unit action ['Getout',vehicle _unit];
	

	deleteVehicle _backpack2;

	//自动开伞
	waitUntil {(position _unit select 2) < 50};
	_unit action ["OpenParachute", _unit];

	waitUntil {(position _unit select 2) < 1};

	removeBackpack _unit;
	if (_backpack == "") exitWith{};

	_unit addbackpack _backpack;
	waitUntil {(backpack _unit) == _backpack};
	
	
	
	clearWeaponCargoGlobal (backpackContainer _unit);
	clearMagazineCargoGlobal (backpackContainer _unit);
	clearItemCargoGlobal (backpackContainer _unit);  


	if (count ((_gear select 1) select 0) > 0) then  {
		for "_i" from 0 to (count ((_gear select 1) select 0) - 1) do
		{  
		(unitBackpack _unit) addweaponCargoGlobal [((_gear select 1) select 0) select _i,((_gear select 1) select 1) select _i];
		};
	};
	if (count ((_gear select 2) select 0) > 0) then  {
		for "_i" from 0 to (count ((_gear select 2) select 0) - 1) do
		{ 
		  (unitBackpack _unit) addMagazineCargoGlobal [((_gear select 2) select 0) select _i,((_gear select 2) select 1) select _i];
		};
	};
	if (count ((_gear select 0) select 0) > 0) then  {
		for "_i" from 0 to (count ((_gear select 0) select 0) - 1) do
		{  
		  (unitBackpack _unit) addItemCargoGlobal [((_gear select 0) select 0) select _i,((_gear select 0) select 1) select _i];
		};
	};
	
	
	/*
};

*/
